#ifndef MEMPOOL_H
#define MEMPOOL_H
#include <stdint.h>
#include "./debug.h"
#include "./memory.h"
#include "./varArray.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  VarArrayStruct* used;
  VarArrayStruct* free;
  uint16_t size;
} MempoolListStruct;  //内存池根据大小分类
typedef struct {
  MempoolListStruct* list;
  VarArrayStruct* unit;
  void* data;
} MempoolBlockStruct;  //内存块

void mempool_init(uint16_t size);
void* mempool_alloc(uint16_t size);
void mempool_free(void* p);
void mempool_info(void);

#ifdef __cplusplus
}
#endif
#endif  // MEMPOOL_H
